<!DOCTYPE html>
<html style="overflow:hidden">
<head>
<title>航班列表</title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="mytask/css/ui-boxlb.css">
<link rel="stylesheet" href="mytask/css/ui-baselb.css"> 
<link rel="stylesheet" href="mytask/css/ui-positionlb.css">
<link rel="stylesheet" href="mytask/css/ui-imglb.css">
<link rel="stylesheet" href="mytask/css/ui-colorlb.css">
<link rel="stylesheet" href="mytask/css/ui-inputlb.css">
<link rel="stylesheet" href="css/iBox.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zy_json.js"></script>
<script src="js/base64.js"></script> 
<script src="mytask/js/jquery.js"></script>
<script src="mytask/js/xmlToJson.js"></script>
<script src="mytask/js/main.js"></script>
<script src="js/talkingdata.js"></script>
<style>
    .dashed{ 
        border-top:1px dashed;
    }  
    [more]{ 
        -webkit-transition: all 0.3s ease
    }
    .mapItem{
        height: 2.8em;
        padding: 0 0.6em;
    }
    .flyImg{
        width: .9em;
        height: .9em;
        padding-top:.3em;
        margin: .4em;
    }
    .surplusImg{
        width: .8em;
        height: .8em;
    }
    .airLineImg{
        width: .6em;
        height: 1.4em;
        background: url("mytask/images/img002.jpg") no-repeat center;
        background-size: .6em;
    }
    .lineImg{
        background: url("mytask/images/img003.jpg") no-repeat center;
    }
    .flyInfo{
        padding: .3em 1.5em .3em .1em;
    }
    .c-gray{
        color:gray;
    }
    .c-blue{
        color:blue;
    }
    .c-red{ 
        color:red;
    }
</style> 
</head>
<body style="overflow:hidden" class="um-vp" ontouchstart> 
<div id="msg" class="uba m10 p10 uc-a5 c17 tx-c uhide">很抱歉，未查询到相应的航班列表</div>
<!-- 列表 --> 
 <div class="ub" style="background: #fff;padding:0 .1em;border-bottom: .0625em solid #eaeaea;">
   <div class="ub" style="background: #fff;padding: .5em 0;width: 99.5%;margin: 0 auto;">
       <div class="ub" style=";padding-left: .7em;width: 95%;font-size: .8125em;background: url(image/Rectangle-15-copy.png)no-repeat 0 0;background-size: 1em;background-position:100% center ;line-height: 1.3em;height:1.3em;" onclick="datePicker()">
           <div id="" >
               航班日期
           </div>
           <div id="" style="background: url(image/iconfont-riqi.png)no-repeat 0 0;background-size: 1.3em;background-position: center 40%;width:1.5em;padding: .5em 0">
           </div>
           <div id="selectDate" style="">
               2017-08-30
           </div>
           <!--div id="" style="background: url(image/Rectangle-15-copy.png)no-repeat 0 0;background-size: 1em;background-position: center ;width:1.2em;padding: .5em 0;margin-left: .3em">
           </div-->
       </div>
   </div>
 </div>
  <div id="" style="background:#eaeaea;">
       <div id="" style="height:1em;">
               
           </div>
      <div id="" style="width:50%;margin:0 auto;">
               <div id="" style="width:100%;padding: .3em 0;border-radius: .4em;text-align: center;background: #1C94EA;color:#fff;" onclick="search()">
                   查询
               </div>
           </div>
           <div id="" style="height:1em;">
               
           </div>
  </div>          
<ul id="list" style="overflow: auto;width: 100%;">
</ul>
</body>
<script>
zy_init();
    window.uexOnload=function(type){ 
        IC.talkingDataCount("我的保障任务","0201");
              var date= new Date();
              var year = check(date.getFullYear());
              var month = check(date.getMonth() + 1);
              var days = check(date.getDate()); 
              var Year=JSON.stringify(year); 
               $$("selectDate").innerHTML=Year+"-"+month+"-"+days;
               initDatePicker("selectDate");
               pullDown();
               getUser();   
    }
var varUserCode = "";   
var varPassword = ""; 
function getUser(){
         //获取掌上东航的账号（用户编号、用户密码）                         
         var localLoginInfor = localStorage.getItem("MU30-USERINFO");
         localLoginInfor=JSON.parse(localLoginInfor);
         varUserCode=localLoginInfor.username;
         varPassword=localLoginInfor.password;
         //varUserCode="qiuyuequan"; 
         //varUserCode="yangpeikun";
         //varUserCode="liujing34";
         // varPassword="cc_900519!"
         setLocVal("varUserCode",varUserCode);  
         setLocVal("varPassword",varPassword);
         initData();
}
function rnull(xy){ 
    if(xy==undefined||xy==null||xy=="undefined"){
        return "-"
    }else{
        return xy;
    }
}
    function initData(){   
        IC.talkingDataCount("我的保障任务","0201"); 
        $("#list").html('');
        uexWindow.toast(1, 5, '正在加载数据...', -1); 
                var date= new Date();
                var year = date.getFullYear(); 
                var month =date.getMonth() + 1;
                var days = date.getDate();   
                if((month+"").length<2) month="0"+month;   
                if((days+"").length<2) days="0"+days;  
                var thedata= year+"-"+month+"-"+days; 
                var seltime=$("#selectDate").text();
                //thedata="2016-11-22";  
               // varUserCode="yangpeikun";
        //var dataUrl=yddfProUrl+"system_getTaskFlight.action?userName="+varUserCode+"&date="+thedata+"&timezone=8";
        //var dataUrl="http://172.31.3.190:8080/mpservice/myTask_getMyFlight.action?employeeName="+varUserCode;
        //varUserCode="yangpeikun";
        var dataUrl="http://mpservice.ceair.com/mpservice/myTask_getMyFlight.action?employeeName="+varUserCode+"&startTime="+seltime+"&endTime=";
          //var dataUrl= "http://mgstest.ceair.com:8080/mpservice/myTask_getMyFlight.action?employeeName="+varUserCode+"&startTime="+seltime+"&endTime=";
          setLocVal("varUserCode_time",seltime);  
       // console.log(dataUrl)
        $.getJSON(dataUrl, function(data){       
            console.log(data)
            if(isNotEmptyObject(data)){   
                  console.log("--------------"+JSON.stringify(data));
               if(data.array=="") $("#msg").removeClass("uhide");
                var pagehtml = ''; 
                  for (var i=0; i < data.length; i++) {
                    var jf,jd,sf,sd,sjf,sjd,AIRPORTNAME,DEPARTUREAIRPORT,PT_AC_POS;
                    var porttype=data[i].MOVEMENTTYPE;
                   sjf=(!isDefine(data[i].ACTUAL_DPT_TIME))?"--:--":data[i].ACTUAL_DPT_TIME; 
                   sjd=(!isDefine(data[i].ACTUAL_ARR_TIME))?"--:--":data[i].ACTUAL_ARR_TIME; 
                   AIRPORTNAME=rnull(data[i].AIRPORTNAME);
                   DEPARTUREAIRPORT=rnull(data[i].DEPARTUREAIRPORT);
                    jf = (!isDefine(data[i].DEPARTURE_STD))?"--:--":data[i].DEPARTURE_STD;
                    jd = (!isDefine(data[i].ARRIVAL_STA))?"--:--":data[i].ARRIVAL_STA;
                    sf = (!isDefine(data[i].DEPARTURE_ETD))?"--:--":data[i].DEPARTURE_ETD;
                    sd = (!isDefine(data[i].ARRIVAL_ETA))?"--:--":data[i].ARRIVAL_ETA; 
                    PT_AC_POS=data[i].PT_AC_POS;
                    PT_AC_POS=rnull(PT_AC_POS);
                    jf=rnull(jf.split(" ")[1]).substr(0,5);
                    jd=rnull(jd.split(" ")[1]).substr(0,5);
                    sf=rnull(sf.split(" ")[1]).substr(0,5);
                    sd=rnull(sd.split(" ")[1]).substr(0,5);  
                    console.log(sjf);
                    sjf=rnull(sjf.split(" ")[1]).substr(0,5);  
                    sjd=rnull(sjd.split(" ")[1]).substr(0,5);  
                    var AIRLINENAME=rnull(data[i].DEPARTUREAIRLINENAME);
                    var FLIGHTNUMBER=rnull(data[i].DEPARTUREFLIGHTNUMBER);
                    var ARRIVALAIRLINENAME=rnull(data[i].ARRIVALAIRLINENAME);
                    var ARRIVALFLIGHTNUMBER=rnull(data[i].ARRIVALFLIGHTNUMBER);
                    var res="";
                    if(ARRIVALAIRLINENAME!="--"&&ARRIVALFLIGHTNUMBER!="--"&&ARRIVALFLIGHTNUMBER!=""&&ARRIVALAIRLINENAME!=""){
                        if(AIRLINENAME!="--"&&AIRLINENAME!=""&&FLIGHTNUMBER!=""&&FLIGHTNUMBER!="--"){
                            res=ARRIVALAIRLINENAME+ARRIVALFLIGHTNUMBER+"/";
                        }else{
                            res=ARRIVALAIRLINENAME+ARRIVALFLIGHTNUMBER;
                        }
                    }
                    var FLIGHT_INFO_ID=rnull(data[i].FLIGHT_INFO_ID); 
                    pagehtml += '<li class="ub ubb pr" style="border-color:#a0a0a0" onclick="openTodayDuty(\''+res+AIRLINENAME+FLIGHTNUMBER+'\','+FLIGHT_INFO_ID+')">'
                            +'<img src="mytask/images/img182.png" class="flyImg" />'
                            +'<div class="ub-f1 flyInfo">'
                            +'<div class="ub ub-pj fs9 pb1" style="padding:.3em 0;">'
                            +'<div class="">'+res+AIRLINENAME+FLIGHTNUMBER+'<span class="ml8 fs8 c-gray"></span></div>'
                            +'<div class="" style="width:6em;text-align:right;">桥位:<span class="fs8 c-gray" >'+PT_AC_POS+'</span></div>'
                            +'</div>'
                            +'<div class="ub ub-pj fs9 pb2 ">'
                            +'<div class="">'+AIRPORTNAME+'</div>'
                            +'<div class="ub ub-f1 ub-pj">'
                            +'<div class="airLineImg"></div>'
                            +'<div class="ub ub-f1 ub-ac ub-pc"><hr class="ub ub-f1" /></div>'
                            +'<div class="airLineImg"></div>'
                            +'</div>'
                            +'<div class="">'+DEPARTUREAIRPORT+'</div>'
                            +'</div>' 
                            +'<div class="ub ub-pj pt2 pb2">'
                            +'<div class="fs7 c-gray">'
                            +'<div class="lh20">计到<span class="ml2">'+jd+'</span></div>'
                            +'<div class="lh20">预到<span class="ml2">'+sd+'</span></div>'
                            +'<div class="lh20">实到<span class="ml2 c-blue">'+sjd+'</span></div>'
                            +'</div>';
                            pagehtml+='<div class="fs7 c-gray">'
                            +'<div class="lh20">计飞<span class="ml2">'+jf+'</span></div>'
                             +'<div class="lh20">预飞<span class="ml2">'+sf+'</span></div>'
                            +'<div class="lh20">实飞<span class="ml2 c-blue">'+sjf+'</span></div>'
                            +'</div>'
                            +'</div>'
                            +'</div>'
                            +'</li>'; 
                }  
                document.getElementById("list").innerHTML=pagehtml;
                uexWindow.closeToast();
            }else{  
                uexWindow.toast(0, 5, "没有更多数据！", 2000);
            }
       }, "json",function(err){
            uexWindow.closeToast();
           alert("err"+JSON.stringify(err));  
       }
       );
    }
     /**
         *点击机号跳转至航班详细界面
         */
     function openTodayDuty(id,openImgId){  
         //IC.talkingDataCount("我的保障任务","0201"); 
           setLocVal("hbh",id); 
           setLocVal("Key",openImgId);   
           openNewWin("ensureNode","ensureNode_task.html");
       }
      function pullDown(){
        var j = {
            "pullToReloadText":"下拉刷新",
            "releaseToReloadText":"释放立即刷新",
            "loadingText":"正在刷新...",
            "loadingImagePath":"res://shuaxin.png"
        };
        if(!uexWindow.setBounce)
            return;
            uexWindow.setBounce("1");
            uexWindow.setBounceParams('0',JSON.stringify(j));
            uexWindow.showBounceView("0","#f4f4f4",1);
            uexWindow.showBounceView("1","#f4f4f4",0);
            uexWindow.notifyBounceEvent("0","1");
            uexWindow.onBounceStateChange = function(type,status){
                if(type==0 && status==2) {
                    uexWindow.resetBounceView('0');
                    initData()
                }
            }
    }; 
    function datePicker(){
          // //IC.talkingDataCount("不正常航班处置","0204"); 
                var date= new Date();
                var year = check(date.getFullYear());
                var month = check(date.getMonth() + 1);
                var days = check(date.getDate());
                uexControl.openDatePicker(year,month,days);
        }  
         function check(myDate){
            if(myDate <　10){
            myDate= "0" + Number(myDate);
            }
            return myDate;
        }
          function initDatePicker(id){
             // //IC.talkingDataCount("不正常航班处置","0204"); 
             //talkingDataCount("外站站长","0061");
            //初始化ios原生日期选择框
                var cText = 0;
                var cJson = 1;
                var cInt = 2;
                //Flag=1;
                uexControl.cbOpenDatePicker=function(opCode,dataType,data){
                    switch(dataType){
                        case cText:
                          //alert("uex.cText");
                          break;
                        case cJson:
                          if(dataType==1){
                            var obj = eval('('+data+')');
                            var date= new Date();
                            var year = date.getFullYear();
                            var month = date.getMonth() + 1;
                            var days = date.getDate();
                            var dd = new Date(); 
                            var year = dd.getFullYear();
                            var month = dd.getMonth() + 1;
                            var days = dd.getDate();
                            dd.setDate(dd.getDate()-1);//获取昨天的日期 
                            var y = dd.getFullYear(); 
                            var m = (dd.getMonth()+1);//获取当前月份的日期
                            var d = dd.getDate(); //获取当前几号
                            var dd1 = new Date(); 
                            dd1.setDate(dd1.getDate()-2);//获取前天的日期 
                            var y1 = dd1.getFullYear(); 
                            var m1 = (dd1.getMonth()+1);//获取当前月份的日期
                            var d1 = dd1.getDate(); //获取当前几号
                            var dd2 = new Date(); 
                            dd2.setDate(dd2.getDate()+1);//获取明天的日期 
                            var y2 = dd2.getFullYear(); 
                            var m2 = (dd2.getMonth()+1);//获取当前月份的日期
                            var d2 = dd2.getDate(); //获取当前几号
                            var dd3 = new Date(); 
                            dd3.setDate(dd3.getDate()+2);//获取后天的日期 
                            var y3 = dd3.getFullYear(); 
                            var m3 = (dd3.getMonth()+1);//获取当前月份的日期
                            var d3 = dd3.getDate(); //获取当前几号
                            Flag=0;
                            if((d2==obj.day&&y2==obj.year&&m2==obj.month)||(d3==obj.day&&y3==obj.year&&m3==obj.month)||(d==obj.day&&y==obj.year&&m==obj.month)||(d1==obj.day&&y1==obj.year&&m1==obj.month)||(days==obj.day&&year==obj.year&&month==obj.month)){
                                var year= obj.year;
                                var yearStr = year.toString();
                                var month=check(obj.month);
                                var day=check(obj.day);
                                //Flag=1;
                                setLocVal("Year",yearStr);
                                $$(id).innerHTML = yearStr+"-"+month+"-"+day;
                            }else{
                                alert("只能选择近三天数据");
                                var date= new Date();
                                var year = check(date.getFullYear());
                                var month = check(date.getMonth() + 1);
                                var days = check(date.getDate());
                                var Year=JSON.stringify(year);
                                setLocVal("Year",Year);
                                $$(id).innerHTML=Year.substr(2,2)+"/"+month+"/"+days;
                                //$$(id).innerHTML = yearStr.substr(2,2)+"/"+month+"/"+day;
                            }
                           // initData()
                           //  $$("flighDataInfo").innerHTML = "";
                           // pageNum=[];
                           // airportSearch();
                           //queryCurrentAirport();
                        }
                        break;
                      case cInt:
                        //alert("uex.cInt");
                        break;
                      default:
                        //alert("error");
                   }
                };
                //queryAirPortInfo();
            }
        function search(){
           // //IC.talkingDataCount("不正常航班处置","0204"); 
            initData()
        }
</script>
</html>